# -*- coding: utf-8 -*-
import scrapy

class DemospiderlocalhostSpider(scrapy.Spider):
    name = 'DemoSpiderLocalhost'
    allowed_domains = ['127.0.0.1']
    start_urls = ['http://127.0.0.1:8000/app1/index/']
    
    def parse(self, response):
        print('{:-^60}'.format('分割线 Start'))
        temp = response.xpath('//*[@id="esa_index_1"]').get()
        print(temp);
        print('{:-^60}'.format('分割线 End'))


        #str(response.body, encoding = "utf8")


        from scrapy.selector.unified import Selector
        from scrapy.selector.unified import SelectorList
        from scrapy.http import Request
        from scrapy.http.request import Request

        #print('{:-^60}'.format('分割线 Start'))

        #print(type(response))
        #print(dir(response))
        #print(response.body_as_unicode())
        #from scrapy.http.response.html import HtmlResponse

        #print('{:-^60}'.format('分割线 End'))


        #print('{:-^60}'.format('分割线 Start'))
        #temp = response.request.body
        ##print(dir(temp))
        ##print(type(temp))
        #print(str(temp, encoding = "utf8"))

        #str(response.body, encoding = "utf8")


        #temp = response.selector;
        #print(response.selector);
        #print(type(response.selector))


        #temp = response.urljoin(url = 'employeekeyid/123');
        #print(temp);
        #print(type(temp))




        #lllist = response.xpath('//*[@id="cnblogs_post_body"]/h2')
        #temp = lllist.getall()
        #print(temp)
        #print(type(temp))
        #for x in lllist:
        #    print(x)

        #print(list.count(lllist))
        #print(lllist.attrib)
        #print(type(lllist.count(lllist)))

        #for x in lllist:
        #    print(x);


        #temp = list.append("123")
        #print(temp)
        #for x in list:
        #    print(x);

        #print(type(response.xpath('//*[@id="esa_index_1"]'))) #<class 'method'>
        #print(dir(response.xpath('//*[@id="esa_index_1"]')))
        #print(response.xpath('//*[@id="esa_index_1"]'))

        #print('{:-^60}'.format('分割线 End'))

        '''
        #print('{:-^60}'.format('分割线 Start'))

        #print(type(response.body_as_unicode())) #<class 'method'>
        #print(dir(response.body_as_unicode))
        #print(response.body_as_unicode())
        #from scrapy.http.response.html import HtmlResponse
        #from scrapy.http.response.text import TextResponse

        #print('{:-^60}'.format('分割线 End'))
        '''

        '''response.body

        #print('{:-^60}'.format('分割线 Start'))
        ##print(response.body())
        #print(type(response.body))
        #print(dir(response.body))
        #print(str(response.body, encoding = "utf8"))
        ##str(b, encoding = "utf8")
        ##scrapy.http.response.html.HtmlResponse
        #from scrapy.http.response.html import HtmlResponse

        #print('{:-^60}'.format('分割线 End'))
        '''

        '''
        #print('{:-^60}'.format('分割线 Start'))
        #print(response.xpath('//*[@id="esa_index_1"]').get());
        #print(response.xpath('//*[@id="esa_index_1"]'));
        #print(type(response.xpath('//*[@id="esa_index_1"]')));
        #print(dir(response.xpath('//*[@id="esa_index_1"]')))
        #from scrapy.selector.unified import Selector
        #print('{:-^60}'.format('分割线 End'))
        '''